<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>你的粉丝</title>
</head>
<body>
    <div id="be_follow">
        <table>
        <tr v-for="name in names">
            <td>{{name.beFollowName}}<td>
            <td>
                <div>
                    <input type="button" value="聊天窗口" :name="name.beFollowName" onclick="talk_click(this.name)">
                </div>
            </td>
        </tr>
        </table>
    </div>
</body>
</html>
<script src="../js/ajax.js"></script>
<script src="../js/vue.js"></script>
<script>
    window.onload=function get_data(){
        let login_name=localStorage.getItem("loginName");
        console.log(login_name)
        new Vue({
            el:"#be_follow",
            data(){
                return{
                    names:[]
                }
            },
            mounted(){
                let _this=this;
                ajax({
                    method:"post",
                    url:"../../follow",
                    data:{
                        loginName:login_name,
                        code:2
                    },
                    success:function (result){
                        console.log(result);
                        _this.names=result;
                    },
                    error: function () {
                        alert("粉丝数据读取失败");
                    }
                })
            }
        })
    }

    function talk_click(e){
        console.log(e)
        window.localStorage.setItem("targetName",e);
        window.location.href="./talk.html";
    }
</script>